{extend name="template/base" /}
{block name="nav"}{/block}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="userid" value="{$id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>照片：</label>
            <div class="formControls col-xs-6 col-sm-6">
                {if $info}
                    <div style="color: #6f6f6f">状态:{if $info['vface']==1}审核失败{elseif $info['vface']==0}审核中{else}审核通过{/if}</div>
                    <img style="width: 365px; height: 365px;" src="{if $info['photo_collect']}{$info['photo_collect']}{else}__STATIC__/images/tx_pic.jpg{/if}" alt="" >
                    <input type="hidden" name="photo" value="{$info['photo_collect']}">
                {/if}
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                {if $info['vface']==2}<!--审核通过-->
                <button type="button" class="btn btn-primary radius" onclick="nopass_photo({$info['userid']})">&nbsp;&nbsp;重新审核&nbsp;&nbsp;</button>
                {else}
                <button type="submit" class="btn btn-success radius">&nbsp;&nbsp;通过审核&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-danger radius" onclick="noPass('/admin/user/noPass.html')">&nbsp;&nbsp;审核不通过&nbsp;&nbsp;</button>
                {/if}

                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript">
    function noPass(url) {
        layer.msg('你确定该照片不予通过吗？', {
            time: 0 //不自动关闭
            ,btn: ['确定', '取消']
            ,yes: function(index){
                layer.close(index);
                var userid = {$id};
                $.ajax({
                    url: url,
                    type: 'post',
                    data:{userid:userid},
                    dataType: 'json',
                    success: function (data) {
                        var jsonText = JSON.parse(data);
                        if(jsonText.code == 0){
                            layer.msg(jsonText.msg,{icon:6});
                        }
                        if(jsonText.code == 1){
                            layer.msg(jsonText.msg,{icon:5});
                        }
                        window.location.reload();
                    }
                })
            }
        });
    }
    function nopass_photo(userid) {
        var userid = userid;
        if (!userid){
            layer.tips('参数错误,请刷新!');
            return false;
        }
        layer.msg('你确定重新审核照片吗？', {
            time: 0 //不自动关闭
            ,btn: ['确定', '取消']
            ,yes: function(index){
                layer.close(index);
                $.ajax({
                    url: "{:\\think\\Url::build('admin/user/nopassPhoto')}",
                    type: 'post',
                    data:{userid:userid},
                    dataType: 'json',
                    success: function (data) {
                        var jsonText = JSON.parse(data);
                        if(jsonText.code == 0){
                            layer.alert(jsonText.msg, {icon:5})
                        }
                        if(jsonText.code == 1){
                            layer.alert(jsonText.msg, {icon:6})
                        }
                        window.location.reload();
                    }
                })
            }
        });
    }
</script>
<script>
    $(function () {
        $("#form").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                ajax_progress(ret);
            }
        });
    })
</script>
{/block}